import { http } from "@/utils/http";

// 查询定时任务调度列表
export function listJob(query) {
  return http.request("get", "/monitor/job/list", { params: query });
}

// 查询定时任务调度详细
export function getJob(jobId) {
  return http.request("get", "/monitor/job/" + jobId);
}

// 新增定时任务调度
export function addJob(data) {
  return http.request("post", "/monitor/job", { data });
}

// 修改定时任务调度
export function updateJob(data) {
  return http.request("put", "/monitor/job", { data });
}

// 删除定时任务调度
export function delJob(jobId) {
  return http.request("delete", "/monitor/job/" + jobId);
}

// 任务状态修改
export function changeJobStatus(jobId, status) {
  const data = {
    jobId,
    status
  };
  return http.request("put", "/monitor/job/changeStatus", { data });
}

// 定时任务立即执行一次
export function runJob(jobId, jobGroup) {
  const data = {
    jobId,
    jobGroup
  };
  return http.request("put", "/monitor/job/run", { data });
}
